<template>
  <div>
    <md-table v-model="users" :table-header-color="tableHeaderColor">

      <md-table-row slot="md-table-row" slot-scope="{ item }" v-on:click="gotodetail(item.applycd)">
        <md-table-cell md-label="申请编号">{{ item.applycd }}</md-table-cell>
        <md-table-cell md-label="客户姓名">{{ item.customername }}</md-table-cell>
        <md-table-cell md-label="贷款金额">{{ item.amount }}</md-table-cell>
        <md-table-cell md-label="贷款期限">{{ item.period }}</md-table-cell>
        <md-table-cell md-label="金融机构">{{ item.bank }}</md-table-cell>
      </md-table-row>

    </md-table>
  </div>
</template>

<script>
export default {
  name: 'simple-table',
  props: {
    tableHeaderColor: {
      type: String,
      default: ''
    }
  },
  methods: {
    gotodetail: data => {
      this.$emit('gotodetail2', data)
      //  alert(this.$route.path);
      //  this.$route.push({path:'/applydetail',query:{id:1}});//类似get传参，通过URL传递参数
      //  this.$root.currentRoute = this.href
      /*
      window.history.pushState(
        null,
        routes[this.href],
        this.href
      )
      */
    }
  },
  data () {
    return {
      selected: [],
      users: [
        {
          applycd: 'BWX20016082423',
          customername: '皖新保金贷',
          amount: '100000.00元',
          period: '36个月',
          bank: '江南行'
        },
        {
          applycd: 'BAH20016082476',
          customername: '张三',
          amount: '100000.00元',
          period: '12个月',
          bank: '有车有家'
        },
        {
          applycd: 'BWX20016082423',
          customername: '王五',
          amount: '100000.00元',
          period: '36个月',
          bank: '江南行'
        }
      ]
    }
  }
}
</script>
